package com.itheima.reggie.mapper;

import com.itheima.reggie.dto.SetmealDto;
import com.itheima.reggie.entity.Setmeal;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SetmealMapper {

    @Select("select count(*) from setmeal where category_id=#{id}")
    Integer findByCategoryId(long id);

    List<SetmealDto> findByPage(@Param("name") String name);
    void save(SetmealDto setmealDto);


    SetmealDto findById(long id);
    void update(SetmealDto setmealDto);

    @Select("select * from setmeal where category_id=#{categoryId} and status=#{status}")
    List<Setmeal> findAllByCidAndStatus(@Param("categoryId") Long categoryId, @Param("status") Integer status);

    void updateStatus(@Param("ids") List<Long> ids, @Param("status") Integer status);

    void delete(@Param("ids") List<Long> ids);
}
